class Node:
    def __init__(self, val):
        self.val = val
        self.next = None

class Solution:
    def check(self, head: Node):
        if head is None or head.next is None:
            return None
        tmp = head
        fast = head
        while fast:
            if fast == head and tmp!=head:
                break
            if fast.next is None:
                return None
            fast = fast.next.next
            head = head.next
        if fast is None:
            return None
        while tmp!=head:
            tmp = tmp.next
            head = head.next
        return head




if __name__ == '__main__':
    so = Solution()
    s = """
0 0 0
0 1 0
1 1 1"""
    s = s[1:]
    s = s.split("\n")
    s = [x.split(" ") for x in s]
    s = [[int(y) for y in x] for x in s]
    print(s)
    r = so.updateMatrix(s)
    print(r)
